<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QFormBuilder Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QFormBuilder Class Reference<br /><sup><sup>[<a href="qtdesigner.html">QtDesigner</a> module]</sup></sup></h1><p>The QFormBuilder class is used to dynamically construct user interfaces from UI files at run-time. <a href="#details">More...</a></p>
<p>Inherits <a href="qabstractformbuilder.html">QAbstractFormBuilder</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qformbuilder.html#QFormBuilder">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qformbuilder.html#addPluginPath">addPluginPath</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qformbuilder.html#clearPluginPaths">clearPluginPaths</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QDesignerCustomWidgetInterface <b><a href="qformbuilder.html#customWidgets">customWidgets</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qformbuilder.html#pluginPaths">pluginPaths</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qformbuilder.html#setPluginPath">setPluginPath</a></b> (<i>self</i>, QStringList)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QFormBuilder class is used to dynamically construct user interfaces from UI files at run-time.</p>
<p>The QFormBuilder class provides a mechanism for dynamically creating user interfaces at run-time, based on UI files created with <i>Qt Designer</i>. For example:</p>
<pre>         MyForm.MyForm(QWidget *parent)
             : QWidget(parent)
         {
             QFormBuilder builder;
             QFile file(":/forms/myWidget.ui");
             file.open(QFile.ReadOnly);
             QWidget *myWidget = builder.load(&amp;file, this);
             file.close();

             QVBoxLayout *layout = new QVBoxLayout;
             layout-&gt;addWidget(myWidget);
             setLayout(layout);
         }</pre>
<p>By including the user interface in the example's resources (<tt>myForm.qrc</tt>), we ensure that it will be present when the example is run:</p>
<pre>     &lt;!DOCTYPE RCC&gt;&lt;RCC version="1.0"&gt;
     &lt;qresource prefix="/forms"&gt;
        &lt;file&gt;mywidget.ui&lt;/file&gt;
     &lt;/qresource&gt;
     &lt;/RCC&gt;</pre>
<p>QFormBuilder extends the <a href="qabstractformbuilder.html">QAbstractFormBuilder</a> base class with a number of functions that are used to support custom widget plugins:</p>
<ul>
<li><a href="qformbuilder.html#pluginPaths">pluginPaths</a>() returns the list of paths that the form builder searches when loading custom widget plugins.</li>
<li><a href="qformbuilder.html#addPluginPath">addPluginPath</a>() allows additional paths to be registered with the form builder.</li>
<li><a href="qformbuilder.html#setPluginPath">setPluginPath</a>() is used to replace the existing list of paths with a list obtained from some other source.</li>
<li><a href="qformbuilder.html#clearPluginPaths">clearPluginPaths</a>() removes all paths registered with the form builder.</li>
<li><a href="qformbuilder.html#customWidgets">customWidgets</a>() returns a list of interfaces to plugins that can be used to create new instances of registered custom widgets.</li>
</ul>
<p>The QFormBuilder class is typically used by custom components and applications that embed <i>Qt Designer</i>. Standalone applications that need to dynamically generate user interfaces at run-time use the <a href="quiloader.html">QUiLoader</a> class, found in the <a href="qtuitools.html">QtUiTools</a> module.</p>
<p>See also <a href="qabstractformbuilder.html">QAbstractFormBuilder</a> and <a href="qtuitools.html">QtUiTools Module</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFormBuilder" />QFormBuilder.__init__ (<i>self</i>)</h3><p>Constructs a new form builder.</p>
<a name="//apple_ref/cpp/instm/QFormBuilder/~QFormBuilder" />
<h3 class="fn"><a name="addPluginPath" />QFormBuilder.addPluginPath (<i>self</i>, QString)</h3><p>Adds a new plugin path specified by <i>pluginPath</i> to the list of paths that will be searched by the form builder when loading a custom widget plugin.</p>
<p>See also <a href="qformbuilder.html#setPluginPath">setPluginPath</a>() and <a href="qformbuilder.html#clearPluginPaths">clearPluginPaths</a>().</p>
<a name="//apple_ref/cpp/instm/QFormBuilder/clearPluginPaths" />
<h3 class="fn"><a name="clearPluginPaths" />QFormBuilder.clearPluginPaths (<i>self</i>)</h3><p>Clears the list of paths that the form builder uses to search for custom widget plugins.</p>
<p>See also <a href="qformbuilder.html#pluginPaths">pluginPaths</a>().</p>
<a name="//apple_ref/cpp/instm/QFormBuilder/customWidgets" />
<h3 class="fn"><a name="customWidgets" />list-of-QDesignerCustomWidgetInterface QFormBuilder.customWidgets (<i>self</i>)</h3><p>Returns a list of the available plugins.</p>
<a name="//apple_ref/cpp/instm/QFormBuilder/pluginPaths" />
<h3 class="fn"><a name="pluginPaths" />QStringList QFormBuilder.pluginPaths (<i>self</i>)</h3><p>Returns the list of paths the form builder searches for plugins.</p>
<p>See also <a href="qformbuilder.html#addPluginPath">addPluginPath</a>().</p>
<a name="//apple_ref/cpp/instm/QFormBuilder/setPluginPath" />
<h3 class="fn"><a name="setPluginPath" />QFormBuilder.setPluginPath (<i>self</i>, QStringList)</h3><p>Sets the list of plugin paths to the list specified by <i>pluginPaths</i>.</p>
<p>See also <a href="qformbuilder.html#addPluginPath">addPluginPath</a>().</p>
<p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.7.1-5014f7c72a58 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.1</td></tr></table></div></address></body></html>